<html>
	<head>
		<title>测试</title>
		<link type='text/css' rel='stylesheet' href='/static/css/test.css' />
		<script type='text/javascript' src='/static/js/jquery-1.8.2.min.js'></script>
	</head>
	<body>
		<div id='test'>asdasdw</div>
		<img src='/static/images/test.jpg' />
		<input type='button' onclick='getJSON();' value='获取json数据' />
		<input type='button' onclick='addData();' value='insert DB' />
	</body>
	<script type='text/javascript'>
		var json;
		function getJSON(){
			$.getJSON('/static/js/data.json', function(data, textStatus) {
				json = JSON.stringify(data);
				console.log(json)
				console.log(data)
				console.log(textStatus)
			});
		}

		function addData(){
			$.ajax({
				url: '/store/addDataByJson/',
				type: 'POST',
				dataType: 'json',
				data: {
					jsonStr:json
				}
			})
			.done(function(data) {
				console.log(data)
				console.log("success");
			})
			.fail(function(e) {
				console.log(e)
				console.log("error");
			})
			.always(function() {
				console.log("complete");
			});
		}
	</script>
</html>